<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 基本表单</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="../favicon.ico">
    <link href="/Public/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/Public/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Public/css/animate.css" rel="stylesheet">
    <link href="/Public/css/style.css?v=4.1.0" rel="stylesheet">
    <style>
        .project-people, .project-actions {
            text-align: left;
            vertical-align: middle;
        }
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form method="post" class="form-horizontal" onsubmit="return false">

                        <div class="form-group">
                            <label class="col-sm-2 control-label">人脸照片：</label>
                            <div class="col-sm-10 project-people" style="display: inline-block;" >
                                    <div class="user_box">

                                        <a href="<{$user_pic.photo}>" class="img_link" data-rel="colorbox"> <img src="<{$user_pic.photo}>" height="165" width="150"/></a>

                                        <if condition="$user_pic.photo1 neq ''">
                                            <a href="<{$user_pic.photo1}>" class="img_link" data-rel="colorbox"> <img src="<{$user_pic.photo1}>" height="165" width="150"/></a>
                                        </if>
                                        <if condition="$user_pic.photo2 neq ''">
                                            <a href="<{$user_pic.photo2}>" class="img_link" data-rel="colorbox"> <img src="<{$user_pic.photo2}>" height="165" width="150"/></a>
                                        </if>
                                    </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">*用户姓名</label>
                            <div class="col-sm-10">
                                <input id="user_name" class="form-control"   type="text" placeholder="请输入用户姓名" value="<{$user.truename}>">
                            </div>
                        </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">*性别</label>
                                <div class="col-sm-10">
                                    <select name=""  id="select_sex" class="form-control">
                                        <option value="">请选择</option>
                                        <option value="1">男士</option>
                                        <option value="2">女士</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">*婚姻状况</label>
                                <div class="col-sm-10">
                                    <select name="" id="select_marry" class="form-control">
                                        <option value="">请选择</option>
                                        <option value="已婚">已婚</option>
                                        <option value="未婚">未婚</option>
                                        <option value="已婚已孕">已婚已孕</option>
                                        <option value="已婚已育">已婚已育</option>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">学历</label>
                                <div class="col-sm-10">
                                    <input class="form-control" type="text" placeholder="请输入学历"  id="degree" value="<{$user.degree}>">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">手机号码</label>
                                <div class="col-sm-10">
                                    <input class="form-control" type="number" disabled="disabled" placeholder="请输入手机号码"
                                    value="<{$user.mobile}>">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">身份证照</label>
                                <div class="col-sm-10 project-people" style="display: inline-block;">
                                    <a href="<{$user_pic.behind}>" class="img_link" data-rel="colorbox"> <img src="<{$user_pic.behind}>"  height="183" width="284"/></a>
                                    <a href="<{$user_pic.front}>" class="img_link" data-rel="colorbox"> <img   src="<{$user_pic.front}>" height="183" width="284"/></a>
                                    <a onclick="update_photo()">修改</a>

                                </div>


                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">身份证号</label>
                                <div class="col-sm-10">
                                    <input class="form-control" type="text" placeholder="请输入身份证号"  id="id_card" value="<{$user.id_card}>">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">身份证归属地</label>
                                <div class="col-sm-10">
                                    <input class="form-control" type="text"   value="<{$user.card_address}>" readonly>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">居住地址</label>
                                <div class="col-sm-10">
                                    <input class="form-control" type="text" placeholder="请输入居住地址" id="live_address" value="<{$user.address}>">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">居住时长</label>
                                <div class="col-sm-10">
                                    <input class="form-control" type="text" placeholder="请输入居住时长" id="live_time" value="<{$user.residence_time}>">
                                </div>
                            </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="button" onclick="save_user()">修改</button>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>


<!-- 全局js -->
<script src="/Public/js/jquery.min.js?v=2.1.4"></script>
<script src="/Public/js/bootstrap.min.js?v=3.3.6"></script>
<!-- 自定义js -->
<script src="/Public/js/content.js?v=1.0.0"></script>
<script src="/Public/admin/js/plugins/fancybox/jquery.fancybox.js"></script>
<script src="/Public/admin/js/plugins/jquery.colorbox-min.js"></script>
<script src="/Public/admin/js/plugins/layer/layer.min.js"></script>

<script src="/Public/admin/js/layer/layer.js"></script>
<script src="/Public/admin/js/layui/layui.js"></script>

<script>
    var sex = "<{$user.sex}>";
    $("#select_sex").val(sex);

    var marray = "<{$user.ismarry}>";
    $("#select_marry").val(marray);


    jQuery(function ($) {
        colorbox_params = {
            reposition: true,
            scalePhotos: true,
            scrolling: false,
            previous: '<i class="fa fa-chevron-left"></i>',
            next: '<i class="fa fa-chevron-right"></i>',
            close: '&times;',
            current: '{current} of {total}',
            maxWidth: '80%',
            maxHeight: '80%',
            onOpen: function () {
                document.body.style.overflow = 'hidden';
            },
            onClosed: function () {
                document.body.style.overflow = 'auto';
            },
            onComplete: function () {
                $.colorbox.resize();
            }
        };
        $('.Info_style [data-rel="colorbox"]').colorbox(colorbox_params);
        $('.project-people [data-rel="colorbox"]').colorbox(colorbox_params);
        $("#cboxLoadingGraphic").append("<i class='icon-spinner orange'></i>");

    });


    //保存修改信息
    function save_user() {

        var index = layer.load(1, {
            shade: [0.1, '#fff'] //0.1透明度的白色背景
        });
        var url = "<{$SRVER_NAME}>/admin.php/UserCenter/user_save";
        var tourl = "";
        var user_name = $("#user_name").val();
        var select_sex = $("#select_sex").val();
        var select_marry = $("#select_marry").val();
        var degree = $("#degree").val();
        var id_card = $("#id_card").val();
        var live_address = $("#live_address").val();
        var live_time = $("#live_time").val();

        var vid = "<{$vid}>";
        if (user_name == "" || select_sex == "" || select_marry == "" || degree == "" || id_card == "" || live_address == "" || live_time == "" ) {
            layer.close(index);
            layer.alert("请信息填写完整！\r\n", {
                title: '提示框',
                icon: 0,
            });
            return false;
        }
        else {

            layer.alert('确定修改数据', {title: '提示框', icon: 3}, function (index) {
                layer.close(index);
                $.post(url, {vid: vid, user_name: user_name, select_sex: select_sex, select_marry: select_marry, degree: degree, id_card: id_card, live_address: live_address, live_time: live_time}, function (data) {
                    if (data.code == "1001") {
                        layer.alert('修改成功', {title: '提示框', icon: 1}, function () {
                            setTimeout(window.parent.loselay(), 5000);
                            layer.close(index);
                        });
                    }
                    else {
                        layer.alert('修改失败', {title: '提示框', icon: 2});
                        layer.close(index);
                    }
                });


            });


        }
    }

    //修改身份证照


        function update_photo() {
            var vid="<{$vid}>";
            layer.open({
                title: '修改身份证照',
                type: 2,
                area: ['43%', '80%'],
                maxmin: true,
                offset: '100px',
                content: ' <{$SRVER_NAME}>/admin.php/UserCenter/update_user_photo.html?vid=' + vid,
                success: function (layero) {
                    layero.find('.layui-layer-min').remove();
                }
            });
        }


</script>
</body>
</html>
